<?php
/**
 * 文件上传类（基于storage）
 * @author ChunYang.Jiang<chunyang@staff.sina.com.cn>
 * @copyright Sina
 * @date 2011-6-9 下午04:55:19
 */
class File
{
	private static $sg = null;//storage句柄
	
	public static function getStor()
	{
		if (empty(self::$sg)){
			self::$sg = new SaeStorage(Config::$STOR_AKEY, Config::$STOR_SKEY);
		}
		return self::$sg;
	}
	
	public static function fileExist($filename)
	{
		
		return self::getStor()->fileExists(Config::$STOR_DOMAIN, $filename);
	}
	
	public static function write($filename, $content)
	{
		return self::getStor()->write(Config::$STOR_DOMAIN, $filename, $content);
	}
	
	public static function read($filename)
	{
		return self::getStor()->read(Config::$STOR_DOMAIN, $filename);
	}
	
	public static function getUrl($filename)
	{
		return self::getStor()->getUrl(Config::$STOR_DOMAIN, $filename);
	}
}